/*******************************************************************************
 * Size: 14 px
 * Bpp: 4
 * Opts: 
 ******************************************************************************/

#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif

#ifndef WATCH_01_FONT
#define WATCH_01_FONT 1
#endif

#if WATCH_01_FONT

/*-----------------
 *    BITMAPS
 *----------------*/

/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
    /* U+0025 "%" */
    0x8, 0xec, 0x10, 0x2, 0xf2, 0x0, 0x3f, 0x3b,
    0x90, 0xa, 0x90, 0x0, 0x7b, 0x5, 0xd0, 0x3f,
    0x10, 0x0, 0x7b, 0x5, 0xd0, 0xc7, 0x0, 0x0,
    0x4e, 0x19, 0xa5, 0xe0, 0x0, 0x0, 0xb, 0xfe,
    0x3e, 0x50, 0x0, 0x0, 0x0, 0x10, 0x7c, 0x8,
    0xed, 0x30, 0x0, 0x1, 0xf4, 0x4f, 0x49, 0xd0,
    0x0, 0x9, 0xb0, 0x6c, 0x3, 0xf0, 0x0, 0x2f,
    0x20, 0x4e, 0x17, 0xd0, 0x0, 0xb9, 0x0, 0x9,
    0xfd, 0x30,

    /* U+002D "-" */
    0x4f, 0xff, 0x10, 0x22, 0x20,

    /* U+002E "." */
    0xb, 0x41, 0xe6,

    /* U+002F "/" */
    0x0, 0xf, 0x60, 0x3, 0xf2, 0x0, 0x7f, 0x0,
    0xa, 0xb0, 0x0, 0xe8, 0x0, 0x1f, 0x40, 0x5,
    0xf1, 0x0, 0x8d, 0x0, 0xc, 0x90, 0x0, 0xf6,
    0x0, 0x3f, 0x20, 0x7, 0xf0, 0x0, 0xab, 0x0,
    0x0,

    /* U+0030 "0" */
    0x0, 0x7e, 0xfd, 0x50, 0x6, 0xf7, 0x49, 0xf2,
    0xd, 0xa0, 0x0, 0xda, 0xf, 0x60, 0x0, 0xad,
    0x1f, 0x50, 0x0, 0x9e, 0x2f, 0x50, 0x0, 0x9e,
    0x1f, 0x50, 0x0, 0x9e, 0xf, 0x60, 0x0, 0xad,
    0xd, 0xa0, 0x0, 0xe9, 0x6, 0xf7, 0x4a, 0xf2,
    0x0, 0x7e, 0xfc, 0x40,

    /* U+0031 "1" */
    0x0, 0x8f, 0x63, 0xef, 0xf6, 0x6a, 0x3f, 0x60,
    0x1, 0xf6, 0x0, 0x1f, 0x60, 0x1, 0xf6, 0x0,
    0x1f, 0x60, 0x1, 0xf6, 0x0, 0x1f, 0x60, 0x1,
    0xf6, 0x0, 0x1f, 0x60,

    /* U+0032 "2" */
    0x2, 0xbe, 0xe9, 0x0, 0x1e, 0xc4, 0x5f, 0xa0,
    0x4e, 0x10, 0x8, 0xf0, 0x0, 0x0, 0x7, 0xf0,
    0x0, 0x0, 0xc, 0xc0, 0x0, 0x0, 0x8f, 0x40,
    0x0, 0x6, 0xf7, 0x0, 0x0, 0x4f, 0x90, 0x0,
    0x3, 0xfa, 0x0, 0x0, 0x2e, 0xd3, 0x33, 0x30,
    0x8f, 0xff, 0xff, 0xf2,

    /* U+0033 "3" */
    0x2f, 0xff, 0xff, 0xa0, 0x2, 0x22, 0xaf, 0x30,
    0x0, 0x7, 0xf3, 0x0, 0x0, 0x6f, 0x40, 0x0,
    0x5, 0xff, 0xd8, 0x0, 0x4, 0x72, 0x5f, 0x90,
    0x0, 0x0, 0x8, 0xf0, 0x0, 0x0, 0x5, 0xf2,
    0x57, 0x0, 0x8, 0xf0, 0x5f, 0x84, 0x7f, 0x80,
    0x5, 0xdf, 0xd7, 0x0,

    /* U+0034 "4" */
    0x0, 0x0, 0x1e, 0x80, 0x0, 0x0, 0xaf, 0x80,
    0x0, 0x5, 0xff, 0x80, 0x0, 0x1e, 0x6e, 0x80,
    0x0, 0xbb, 0xe, 0x80, 0x6, 0xe1, 0xe, 0x80,
    0x2f, 0x50, 0xe, 0x80, 0x9f, 0xff, 0xff, 0xff,
    0x13, 0x33, 0x3e, 0x92, 0x0, 0x0, 0xe, 0x80,
    0x0, 0x0, 0xe, 0x80,

    /* U+0035 "5" */
    0x4, 0xff, 0xff, 0xf1, 0x6, 0xe3, 0x33, 0x30,
    0x8, 0xc0, 0x0, 0x0, 0xa, 0xa0, 0x0, 0x0,
    0xc, 0xcd, 0xfc, 0x30, 0xd, 0xd4, 0x4c, 0xe1,
    0x0, 0x0, 0x2, 0xf6, 0x0, 0x0, 0x0, 0xf8,
    0x8, 0x10, 0x2, 0xf6, 0xd, 0xd5, 0x4c, 0xe1,
    0x1, 0xae, 0xfb, 0x20,

    /* U+0036 "6" */
    0x0, 0x0, 0xeb, 0x0, 0x0, 0xa, 0xe1, 0x0,
    0x0, 0x5f, 0x40, 0x0, 0x1, 0xe8, 0x0, 0x0,
    0x9, 0xfd, 0xfd, 0x50, 0xf, 0xe5, 0x3a, 0xf3,
    0x4f, 0x50, 0x0, 0xea, 0x4f, 0x30, 0x0, 0xbb,
    0x2f, 0x50, 0x0, 0xe9, 0xb, 0xe6, 0x4b, 0xf3,
    0x0, 0x9e, 0xfc, 0x40,

    /* U+0037 "7" */
    0x6f, 0xff, 0xff, 0xf6, 0x13, 0x33, 0x37, 0xf2,
    0x0, 0x0, 0xa, 0xc0, 0x0, 0x0, 0x2f, 0x50,
    0x0, 0x0, 0x8e, 0x0, 0x0, 0x0, 0xf7, 0x0,
    0x0, 0x6, 0xf1, 0x0, 0x0, 0xd, 0xa0, 0x0,
    0x0, 0x4f, 0x30, 0x0, 0x0, 0xbc, 0x0, 0x0,
    0x2, 0xf5, 0x0, 0x0,

    /* U+0038 "8" */
    0x0, 0x7e, 0xfc, 0x30, 0x7, 0xf6, 0x3b, 0xe1,
    0xd, 0xa0, 0x1, 0xf6, 0xe, 0x90, 0x0, 0xf7,
    0x9, 0xf3, 0x8, 0xf2, 0x0, 0xdf, 0xff, 0x70,
    0xb, 0xd5, 0x37, 0xf5, 0x3f, 0x30, 0x0, 0xad,
    0x4f, 0x40, 0x0, 0xad, 0xd, 0xd5, 0x38, 0xf7,
    0x1, 0xae, 0xfd, 0x60,

    /* U+0039 "9" */
    0x1, 0xaf, 0xfb, 0x20, 0xd, 0xd5, 0x4d, 0xe0,
    0x5f, 0x20, 0x2, 0xf6, 0x7f, 0x0, 0x0, 0xf8,
    0x6f, 0x10, 0x1, 0xf8, 0x1f, 0xb1, 0x1a, 0xf4,
    0x5, 0xef, 0xff, 0xd0, 0x0, 0x2, 0x4f, 0x30,
    0x0, 0x1, 0xd8, 0x0, 0x0, 0xb, 0xd0, 0x0,
    0x0, 0x7f, 0x30, 0x0,

    /* U+006D "m" */
    0x2d, 0x5d, 0xfd, 0x36, 0xef, 0xb1, 0x2f, 0xe5,
    0x3d, 0xed, 0x44, 0xe9, 0x2f, 0x60, 0x6, 0xf3,
    0x0, 0x9d, 0x2f, 0x40, 0x5, 0xf1, 0x0, 0x8e,
    0x2f, 0x40, 0x5, 0xf1, 0x0, 0x8e, 0x2f, 0x40,
    0x5, 0xf1, 0x0, 0x8e, 0x2f, 0x40, 0x5, 0xf1,
    0x0, 0x8e, 0x2f, 0x40, 0x5, 0xf1, 0x0, 0x8e,

    /* U+007E "~" */
    0x6, 0xed, 0x52, 0xf3, 0xf, 0x54, 0xef, 0xc0,
    0x3, 0x0, 0x2, 0x0
};


/*---------------------
 *  GLYPH DESCRIPTION
 *--------------------*/

static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
    {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
    {.bitmap_index = 0, .adv_w = 183, .box_w = 12, .box_h = 11, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 66, .adv_w = 77, .box_w = 5, .box_h = 2, .ofs_x = 0, .ofs_y = 3},
    {.bitmap_index = 71, .adv_w = 54, .box_w = 3, .box_h = 2, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 74, .adv_w = 76, .box_w = 5, .box_h = 13, .ofs_x = 0, .ofs_y = -1},
    {.bitmap_index = 107, .adv_w = 140, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 151, .adv_w = 96, .box_w = 5, .box_h = 11, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 179, .adv_w = 124, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 223, .adv_w = 125, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 267, .adv_w = 134, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 311, .adv_w = 132, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 355, .adv_w = 132, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 399, .adv_w = 126, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 443, .adv_w = 137, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 487, .adv_w = 131, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 531, .adv_w = 203, .box_w = 12, .box_h = 8, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 579, .adv_w = 132, .box_w = 8, .box_h = 3, .ofs_x = 0, .ofs_y = 4}
};

/*---------------------
 *  CHARACTER MAPPING
 *--------------------*/

static const uint16_t unicode_list_0[] = {
    0x0, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe,
    0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x48, 0x59
};

/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
    {
        .range_start = 37, .range_length = 90, .glyph_id_start = 1,
        .unicode_list = unicode_list_0, .glyph_id_ofs_list = NULL, .list_length = 16, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
    }
};

/*-----------------
 *    KERNING
 *----------------*/


/*Pair left and right glyphs for kerning*/
static const uint8_t kern_pair_glyph_ids[] =
{
    2, 6,
    2, 7,
    2, 8,
    2, 12,
    2, 14,
    3, 6,
    3, 9,
    3, 11,
    3, 12,
    3, 14,
    4, 2,
    4, 3,
    4, 4,
    4, 5,
    4, 9,
    4, 10,
    4, 11,
    4, 13,
    4, 14,
    4, 15,
    5, 4,
    5, 12,
    6, 12,
    7, 2,
    8, 6,
    8, 10,
    8, 12,
    8, 14,
    9, 6,
    9, 10,
    9, 12,
    9, 14,
    10, 6,
    10, 11,
    10, 12,
    10, 14,
    11, 6,
    11, 12,
    11, 14,
    12, 2,
    12, 3,
    12, 4,
    12, 5,
    12, 9,
    12, 10,
    12, 11,
    12, 12,
    12, 13,
    12, 15,
    13, 4,
    13, 6,
    13, 12,
    13, 14,
    14, 2,
    14, 3,
    14, 4,
    14, 8,
    14, 9,
    14, 10,
    14, 11,
    14, 12,
    14, 13,
    15, 12
};

/* Kerning between the respective left and right glyphs
 * 4.4 format which needs to scaled with `kern_scale`*/
static const int8_t kern_pair_values[] =
{
    -12, -8, -5, -22, -4, -18, -4, -3,
    -11, -9, -13, -27, -25, -2, -19, -3,
    -10, -5, -1, -9, -2, -7, -3, -7,
    -4, -2, -6, -4, -4, -4, -10, -4,
    -4, -1, -7, -4, -11, -15, -7, -20,
    -23, -25, -5, -20, -4, -14, 1, -5,
    -5, -2, -3, -9, -2, -6, -13, -15,
    -2, -9, -2, -6, -6, -2, -6
};

/*Collect the kern pair's data in one place*/
static const lv_font_fmt_txt_kern_pair_t kern_pairs =
{
    .glyph_ids = kern_pair_glyph_ids,
    .values = kern_pair_values,
    .pair_cnt = 63,
    .glyph_ids_size = 0
};

/*--------------------
 *  ALL CUSTOM DATA
 *--------------------*/

#if LV_VERSION_CHECK(8, 0, 0)
/*Store all the custom data of the font*/
static  lv_font_fmt_txt_glyph_cache_t cache;
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
    .glyph_bitmap = glyph_bitmap,
    .glyph_dsc = glyph_dsc,
    .cmaps = cmaps,
    .kern_dsc = &kern_pairs,
    .kern_scale = 16,
    .cmap_num = 1,
    .bpp = 4,
    .kern_classes = 0,
    .bitmap_format = 0,
#if LV_VERSION_CHECK(8, 0, 0)
    .cache = &cache
#endif
};


/*-----------------
 *  PUBLIC FONT
 *----------------*/

/*Initialize a public general font descriptor*/
#if LV_VERSION_CHECK(8, 0, 0)
const lv_font_t watch_01_font = {
#else
lv_font_t watch_01_font = {
#endif
    .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt,    /*Function pointer to get glyph's data*/
    .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt,    /*Function pointer to get glyph's bitmap*/
    .line_height = 13,          /*The maximum line height required by the font*/
    .base_line = 1,             /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
    .subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
    .underline_position = -1,
    .underline_thickness = 1,
#endif
    .dsc = &font_dsc           /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};



#endif /*#if WATCH_01_FONT*/

